Skip to content

Fix/252 polygon holes subgroup#326

Open
Nishita-shah1 wants to merge 4 commits into
masterfrom
fix/252-polygon-holes-subgroup
Open

Fix/252 polygon holes subgroup#326
Nishita-shah1 wants to merge 4 commits into
masterfrom
fix/252-polygon-holes-subgroup

Conversation

@Nishita-shah1
Copy link
Copy Markdown

@Nishita-shah1 Nishita-shah1 commented May 17, 2026

Closes #252

creating pr from branch instead of from fork

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.13%. Comparing base (00f0d7b) to head (d843774).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #326      +/-   ##
==========================================
- Coverage   73.01%   69.13%   -3.89%     
==========================================
  Files         164      163       -1     
  Lines        8835     6000    -2835     
==========================================
- Hits         6451     4148    -2303     
+ Misses       2384     1852     -532     
Flag Coverage Δ
javascript ?
r 69.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@tdhock tdhock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also please post screenshots of the test cases?

path.list <- getNodeSet(html, '//g[contains(@class,"geom")]//path')
expect_true(length(path.list) >= 1)
d.vals <- sapply(path.list, function(node) xmlGetAttr(node, "d"))
expect_true(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please avoid expect_true, and use expect_ something more specific like equal?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll update it.

@Nishita-shah1
Copy link
Copy Markdown
Author

can you also please post screenshots of the test cases?
Hi @tdhock ,
these are the screenshots of the test-renderer-polygon-holes.R file test cases.

image image

@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented May 22, 2026

I tried this small-scale real data application, https://github.com/tdhock/hicream-viz/blob/main/data-2025-10-09/figure-pixels-chr1-Cluster73-fix.R and this PR works!

image

top: this PR.
bottom: master branch.

@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented May 22, 2026

here is a rendered animint using this PR https://tdhock.github.io/2026-05-22-HiC-pixels-chr1-Cluster73-subgroup/
image

and the same animint which does not render correctly using current master https://tdhock.github.io/2026-05-22-HiC-pixels-chr1-Cluster73-bad/
image

this is evidence of a successful implementation, great work, thanks very much Nishita!

@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented May 22, 2026

currently there is only one clickID in tests. are these tests strong enough to fail on current master?

the issue #252 had a screenshot of master drawing the test case like this:
image
we should add a clickID or mouseMove to the test so that it fails when drawn with current master.
for example, if we put clickSelects and showSelected on the polygon, and draw a red dot behind the polygon in the area that it is incorrectly drawn (hold_and_mid_mid_bottom), then clickID on the red dot, it will actually click on the polygon, which will hide the polygon, and so we should add an expectation that the polygon is still visible even after that click. Does that make sense?

Comment on lines +1 to +5
library(testthat)
library(animint2)
library(XML)
context("Polygon holes via subgroup aesthetic")
tests_init()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please delete all this from test files

## hole_and_mid: outer ring + hole + island (3 subgroups)
## only_hole: outer ring + hole (2 subgroups)
## no_hole: outer ring only (1 subgroup)
make.full.data <- function(){
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not necessary (and potentially confusing) to create a function if you only call it once.

0,1,0,0,1,0,
0,1,1,1,1,0,
0,0,0,0,0,0), 6, 6, byrow=TRUE)
res <- isoband::isobands(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use contourLines() instead of isobands() so we can avoid adding a dependency.

@Nishita-shah1
Copy link
Copy Markdown
Author

currently there is only one clickID in tests. are these tests strong enough to fail on current master?

the issue #252 had a screenshot of master drawing the test case like this: image we should add a clickID or mouseMove to the test so that it fails when drawn with current master. for example, if we put clickSelects and showSelected on the polygon, and draw a red dot behind the polygon in the area that it is incorrectly drawn (hold_and_mid_mid_bottom), then clickID on the red dot, it will actually click on the polygon, which will hide the polygon, and so we should add an expectation that the polygon is still visible even after that click. Does that make sense?

yes, we can do that. I'll add some more tests.

@Nishita-shah1
Copy link
Copy Markdown
Author

here is a rendered animint using this PR https://tdhock.github.io/2026-05-22-HiC-pixels-chr1-Cluster73-subgroup/ image

and the same animint which does not render correctly using current master https://tdhock.github.io/2026-05-22-HiC-pixels-chr1-Cluster73-bad/ image

this is evidence of a successful implementation, great work, thanks very much Nishita!

Thank you @tdhock , I surely update the tests based on the feedbacks and correct the naming of the tests.

@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented May 23, 2026

actually can you please just close this PR and port your new JS code to #328 ?

@tdhock
Copy link
Copy Markdown
Collaborator

tdhock commented May 23, 2026

please do keep those review comments in mind for future PRs though.

@Nishita-shah1
Copy link
Copy Markdown
Author

Sure @tdhock , I'll close this PR and port to #328 .
Yes, I'll keep in mind the review comments for future PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

draw polygon / path with holes

2 participants